import { css } from './styles.js';
import '@shoelace-style/shoelace/dist/components/button/button.js';
import '@shoelace-style/shoelace/dist/components/input/input.js';
import '@shoelace-style/shoelace/dist/components/icon/icon.js';
import '@shoelace-style/shoelace/dist/components/icon-button/icon-button.js';
import '../../../utils/shoelace-config.js';
import { 
    render, 
    bindEvents, 
    openModal, 
    closeModal 
} from './scripts.js';

class EmailLogin extends HTMLElement {
    constructor() {
        super();
        this.attachShadow({ mode: 'open' });
        
        // 初始化状态
        this.isOpen = false;
        this.isLoading = false;
        
        // 渲染组件
        render(this.shadowRoot, css);
        bindEvents(this);
    }

    // 公共方法：程序化打开/关闭弹窗
    open() {
        openModal(this);
    }

    close() {
        closeModal(this);
    }
}

// 注册自定义元素
window.customElements.define('email-login', EmailLogin);